{	Problem: http://codeforces.ru/problemset/problem/42/A
 	Verdict: Accepted
}
var n,v,m,s,i:longint; a,b:array[1..30] of longint; r,c:double;
begin
read(n,v);
s:=0;
r:=0;
for i:=1 to n do begin
  read(a[i]);
  inc(s,a[i]);
end;
for i:=1 to n do read(b[i]);
m:=1;
for i:=2 to n do
  if b[i]/a[i]<b[m]/a[m] then m:=i;
c:=b[m]/a[m];
for i:=1 to n do
  r:=r+a[i]*c;
if r>v then r:=v;
write(r:0:4);
end.